home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
tex
/
rtextu10.zip
/
WC.DOC
< prev
next >
Wrap
Text File
|
1993-05-06
|
5KB
|
123 lines
# # #####
# # # # #
# # # #
# # # #
# # # #
# # # # #
## ## #####
You can get part of the following documentation by invoking the program with
the switches -v, -h, or -H . See README.TXT for more information.
----------------------------------- -v ------------------------------------
WC v1.0 -- Count words, lines, and characters in several text files
Copr (c) 1992,1993 Richard Breuer. WC is freeware. No warranties.
This is WC/2 v1.0 - renamed to WC (from RUTILS 4).
Author: Richard Breuer
Brunssumstrasse 6
5100 Aachen
(after Jul 1, 1993: 52074 Aachen)
Germany
Europe
Phone: +49/241/85605
Fax: +49/241/8021329
Email: ricki@pool.informatik.rwth-aachen.de (Preferred!)
----------------------------------- -h ------------------------------------
WC v1.0 -- Count words, lines, and characters in several text files
Copr (c) 1992,1993 Richard Breuer. WC is freeware. No warranties.
Usage:
WC [-clhHmnuvwx*] infile.. [{>|>>} outfile]
Options (+ are default):
+ -c Count characters - omitting NEWLINE characters!
+ -l Count lines
-h Display this help screen
-H Display another help screen with notes and examples
-m Compute the length of the longest line
-n Use "normal" character set: words are built only from letters and digits
+ -u Operate like Unix's wc: a word is a string of characters delimited by
SPACE, TAB, or NEWLINE characters
-v Display version info and information about the author
+ -w Count words
-x Use extended character set: "_" and "$" are treated as valid word
characters. Thus integer_var is counted as one, not two words. Gives
eg. more reliable results for Pascal source code
-* Display internal information (for debugging purposes)
----------------------------------- -H ------------------------------------
WC v1.0 -- Count words, lines, and characters in several text files
Copr (c) 1992,1993 Richard Breuer. WC is freeware. No warranties.
Notes:
WC reads from stdin if a filename is -. The output is always directed
to stdout. The line lengths are restricted to 255 characters. Longer lines
will be cut. The errorlevel is set to 1 if help has been displayed. It is
set to 255 in case of an error and 0 on normal completion. Output resulting
from multiple input files is appended to stdout. The processing order for
wildcards depends on the order of the directory entries. WC returns
nonsense for binary files. If WC is called without options, a word
matches the regular expression [^ \t\n][^ \t\n]*.
Examples:
WC *.TXT
Process all *.TXT files in the current directory. The processing order
is the one DOS's dir tells you.
WC HEADER.TXT - FOOTER.TXT
After processing HEADER.TXT the user must input text from the keyboard
until Ctrl/Z (=EOF) is detected. Then FOOTER.TXT is processed. All output
is appended on stdout.
WC -l C:\TXT\
Count the lines of all files in the directory C:\TXT.
-------------------------------------------------------------------------------
Additional information:
WC is similar to the Unix command with the same name. The main difference
is the way WC counts characters. The Unix version, as most DOS versions,
simply sets the character count to the length of the file in bytes. This is
not sufficient in my opinion. My WC counts everything but the CR/LF bytes
at the end of each line, which represents the REAL characters in the text
file. Therefore my WC will likely compute a character count which is some
amount smaller than the count other WC's compute.
The following example illustrates the difference between the way WC counts
words for the three switches -u, -x, and -n. Consider a file DUMMY.DAT which
contains one single line
HELLO,WORLD_NET
C:> WC -u DUMMY.DAT
1 1 15 DUMMY.DAT
-u switches to Unix mode which means that words are delimited by SPACEs
and TABs only. Therefore "HELLO,WORLD_NET" is one word. -u is the
default mode.
C:> WC -x DUMMY.DAT
1 2 15 DUMMY.DAT
-x switches to the 'extended' character set, which means that _ and $
are supposed to be contained in words, whereas all other characters
which are not letters or digits, are taken as delimiters. Therefore
"HELLO,WORLD_NET" are two words: "HELLO" and "WORLD_NET", delimited by
the comma.
C:> WC -n DUMMY.DAT
1 3 15 DUMMY.DAT
-n switches to the 'normal' character set, which means that _ and $
are taken as delimiters, as well as any other character which is not a
letter or a digit. Therefore "HELLO,WORLD_NET" are now three words:
"HELLO", "WORLD", and "NET", delimited by the comma and the "_".